<template>
	<view class="lablebox">
		<view class="bothlabe" v-for="(item,index) in arr" :key="index" @click="select(item)" :class="isarrone(item.id)?'specil':''">
			{{item.text}}
		</view>
		<view class="bothlabe">
			<input type="text" v-model="zhi"  @blur="shuru" @focus="shiqu"/>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				zhi: '自定义'
			}
		},
		props:{
			arr:{type:Array,default:[]},
			arr1:{type:Array,default:[]}
		},
		methods:{
			select(item){
				this.$emit("selectItem",item)
			},
			isarrone(id){
				let flag=false
				for(let i=0;i<this.arr1.length;i++){
					// debugger
					if(this.arr1[i]==id){
						return flag=true
					}
				}
				return flag
			},
			shuru(e){
				this.$emit("shuruItem",{text:e.detail.value,id:e.detail.value})
			},
			shiqu(){
				this.zhi=""
			}
		},
		
	}
</script>

<style scoped lang="less">
	.lablebox {
		display: flex;
		flex-wrap: wrap;
		.bothlabe {
			width: 122rpx;
			height: 60rpx;
			background-color: #ffffff;
			border-radius: 10rpx;
			border: solid 2rpx #ccc;
			line-height: 60rpx;
			text-align: center;
			margin-left: 10rpx;
			margin-bottom: 10rpx;
			input{
				height: 60rpx;
				line-height: 60rpx;
			}
		}
		.specil{
			color: #e13c35;
			border: solid 2rpx #e13c35;
		}
	}
</style>
